#pragma once

#include <AVUIDependencyProperty.h>

namespace AVUI {

class BindingBase;

/// <summary>Initializes a new instance of the <see cref="T:System.Windows.Condition" /> class. </summary>
class Condition : public Object
{
    friend class XamlParser;
public:
    DECLARE_ELEMENT(Condition, Object);

#pragma region Public Methods

    /// <summary>Initializes a new instance of the <see cref="T:System.Windows.Condition" /> class. </summary>
    Condition();

    /// <summary>Initializes a new instance of the <see cref="T:System.Windows.Condition" /> class. </summary>
    /// <param name="binding">The binding that specifies the property of the condition.</param>
    /// <param name="conditionValue">The value of the condition.</param>
    Condition(BindingBase* pBinding, Object* pConditionValue);

    /// <summary>Initializes a new instance of the <see cref="T:System.Windows.Condition" /> class with the specified property and value. This constructor performs parameter validation. </summary>
    /// <param name="conditionProperty">The property of the condition.</param>
    /// <param name="conditionValue">The value of the condition.</param>
    Condition(DependencyProperty* pConditionProperty, Object* pConditionValue);

    /// <summary>Initializes a new instance of the <see cref="T:System.Windows.Condition" /> class with the specified property, value, and the name of the source object.</summary>
    /// <param name="conditionProperty">The property of the condition.</param>
    /// <param name="conditionValue">The value of the condition.</param>
    /// <param name="sourceName">x:Name of the object with the <paramref name="conditionProperty" />.</param>
    Condition(DependencyProperty* pConditionProperty, Object* pConditionValue, String* pSourceName);

#pragma endregion Public Methods

#pragma region Public Properties

    /// <summary>Gets or sets the binding that specifies the property of the condition. This is only applicable to <see cref="T:System.Windows.MultiDataTrigger" /> objects.</summary>
    /// <returns>The default value is null.</returns>
    BindingBase* get_Binding() { return m_pBinding; }
    void set_Binding(BindingBase* pValue);
    DECLARE_PROPERTY(Binding, BindingBase, false);

    /// <summary>Gets or sets the property of the condition. This is only applicable to <see cref="T:System.Windows.MultiTrigger" /> objects.</summary>
    /// <returns>A <see cref="T:System.Windows.DependencyProperty" /> that specifies the property of the condition. The default value is null.</returns>
    DependencyProperty* get_Property() { return m_pProperty; }
    void set_Property(DependencyProperty* pValue);
    DECLARE_PROPERTY(Property, DependencyProperty, false);

    /// <summary>Gets or sets the name of the object with the property that causes the associated setters to be applied. This is only applicable to <see cref="T:System.Windows.MultiTrigger" /> objects.</summary>
    /// <returns>The default property is null. If this property is null, then the property of the object being styled causes the associated setters to be applied.</returns>
    /// <exception cref="T:System.InvalidOperationException">After a <see cref="T:System.Windows.Condition" /> is in use, it cannot be modified.</exception>
    String* get_SourceName() { return m_pSourceName; }
    void set_SourceName(String* pValue);
    DECLARE_PROPERTY(SourceName, String, false);

    /// <summary>Gets or sets the value of the condition.</summary>
    /// <returns>The <see cref="P:System.Windows.Condition.Value" /> property cannot be null for a given <see cref="T:System.Windows.Condition" />.See also the Exceptions section. The default value is null.</returns>
    /// <exception cref="T:System.ArgumentException">
    /// <see cref="T:System.Windows.Markup.MarkupExtension" />s are not supported.</exception>
    /// <exception cref="T:System.ArgumentException">Expressions are not supported.</exception>
    Object* get_Value() { return m_pValue; }
    void set_Value(Object* pValue);
    DECLARE_PROPERTY(Value, Object, false);

#pragma endregion Public Properties

public:

#pragma region Internal Methods

    void Seal(ValueLookupType::Enum type);

#pragma endregion Internal Methods

private:

    TRefCountedPtr<BindingBase> m_pBinding;
    DependencyProperty* m_pProperty;
    bool m_sealed;
    TRefCountedPtr<String> m_pSourceName;
    TRefCountedPtr<Object> m_pValue;
};


}; // namespace AVUI
